import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux'
import { createStore, applyMiddleware, compose } from 'redux'
import thunk from 'redux-thunk'
import reducer from './reducer'
import { BrowserRouter as Router, Route, Switch, Redirect } from 'react-router-dom'
import App from './App';
import './index.css'

//导入路由组件
import Login from './container/login'
import Register from './container/register'
import Authrouter from './component/authrouter'
import Bossinfo from './container/bossinfo/bossinfo'
import Geniusinfo from './container/geniusinfo/geniusinfo'
import Dashboard from './component/dashboard/dashboard'

//配置store 中间件
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(reducer, composeEnhancers(
    applyMiddleware(thunk)
))


function Boss() {
    return <h1>111</h1>
}

ReactDOM.render(
    <Provider store={store}>
        <Router>
            <div>
                <Authrouter></Authrouter>
                {/* <Route path='/' component={Login}></Route> */}
                <Switch>
                    <Route path='/login' component={Login}></Route>
                    {/* <Route path='/boss' component={Boss}></Route> */}
                    <Route path='/register' component={Register}></Route>
                    <Route path='/bossinfo' component={Bossinfo}></Route>
                    <Route path='/geniusinfo' component={Geniusinfo}></Route>
                    <Route component={Dashboard}></Route>
                </Switch>
            </div>
        </Router>
    </Provider>
    , document.getElementById('root'));



